﻿@{
    ViewBag.Title = "Resetpassword";
}
@using (Ajax.BeginForm("Resetpassword", "Login", new AjaxOptions(), new { @class = "registerform" }))
{ 
    <div class="userlgn1">
        <ul>
            <li>
                <label>邮箱/手机号：</label>@Html.TextBox("mail",null,new{datatype="mmm",errormsg="请填写正确的手机号码或者电子邮件"})   
            </li>
            <li>
                <label>验证码：</label>@Html.TextBox("ValidateCode",null,new{datatype="n5-5",errormsg="请填写正确的验证码"})
                <img id="valiCode" style="cursor: pointer;" src="@Url.Action("GetValidateCode")" alt="验证码" />
            </li>
            <li class="sbmtbtn">
                <input id="btnSubmit" type="submit" value="邮箱找回" />
            </li>
        </ul>
    </div>
}
<script>
    $(function () {
        $("#valiCode").bind("click", function () {
            this.src = "@Url.Action("GetValidateCode")?time=" + (new Date()).getTime();
        }); 
       
        

        $(".registerform").Validform({
            tiptype:1,
            datatype: {//传入自定义datatype类型【方式二】;
                "mmm": function (gets, obj, curform, regxp) {
                    //参数gets是获取到的表单元素值，obj为当前表单元素，curform为当前验证的表单，regxp为内置的一些正则表达式的引用;
                    var reg1 = /^13[0-9]{9}$|14[0-9]{9}|15[0-9]{9}$|18[0-9]{9}$/
                    var reg2= /^\w+([-+.']\w+)*@@\w+([-.]\w+)*\.\w+([-.]\w+)*$/

                    if (reg1.test(gets) || reg2.test(gets)) { return true; } 
                    return false; 
                    
                }
            }
        });


    });
</script>
